/**
 * Project: wx-web
 * 
 * File Created at 2013-10-30
 * $Id$
 * 
 * Copyright 2010 200power.com.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Dianping Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with dianping.com.
 */
package com.power.wx;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import junit.framework.Assert;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * 
 * @author liuming
 * 
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath*:config/spring/app.xml" })
public abstract class BaseTestCase {

	protected void print(Object obj) {
		System.out.println(ToStringBuilder.reflectionToString(obj, ToStringStyle.MULTI_LINE_STYLE));
	}

	private long start;

	public void notNull(Object obj) {
		assertNotNull(obj);
	}

	public void isNull(Object obj) {
		assertNull(obj);
	}

	public void equal(Object expected, Object actual) {
		Assert.assertEquals(expected, actual);
	}

	public void start() {
		this.start = System.currentTimeMillis();
	}

	public void end() {
		System.out.println("耗时: " + (System.currentTimeMillis() - start) + "ms");
	}
}
